package util.logging;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Date;
import java.util.logging.ConsoleHandler;
import java.util.logging.FileHandler;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.LogManager;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;

public class ConfigurationExample {

	private static final LogManager logManager = LogManager.getLogManager();
	private static final Logger LOGGER = Logger.getLogger("confLogger");
	static{
		try {
			logManager.readConfiguration(new FileInputStream("c:\\log\\log.properties"));
		} catch (IOException exception) {
			LOGGER.log(Level.SEVERE, "Error in loading configuration",exception);
		}
	}
	public static void main(String[] args){
		
		LOGGER.fine("hiii"); 
	}/* {
		        Handler consoleHandler = null;
		        Handler fileHandler  = null;
		        try{
		            //Creating consoleHandler and fileHandler
		            consoleHandler = new ConsoleHandler();
		            fileHandler  = new FileHandler("c:\\log\\crm.log");
		            SimpleFormatter sf = new SimpleFormatter();
		            
		            
		            fileHandler.setFormatter(sf);
		            //Assigning handlers to LOGGER object
		            LOGGER.addHandler(consoleHandler);
		            LOGGER.addHandler(fileHandler);
		            
		            //Setting levels to handlers and LOGGER
		            consoleHandler.setLevel(Level.ALL);
		            fileHandler.setLevel(Level.ALL);
		            LOGGER.setLevel(Level.ALL);
		            LOGGER.config("Configuration done.");
	
		            //Console handler removed
		
		            LOGGER.removeHandler(consoleHandler);
		
		             
		
		            LOGGER.log(Level.FINE, "Finer logged");
		
		        }catch(IOException exception){
		
		            LOGGER.log(Level.SEVERE, "Error occur in FileHandler.", exception);
		
		        }
		        LOGGER.finer("Finest example on LOGGER handler completed.");
		    
		
		    }
*/
}
